package com.nolydake.swingnote.model;

import java.util.Date;
import java.util.List;

import org.nutz.dao.Dao;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Many;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.One;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.impl.NutDao;

import com.nolydake.swingnote.SwingNoteApplication;

@Table("noteforder")
public class NoteForder {

    public static void main(String[] args) {
        SwingNoteApplication.getInstance();

        Dao dao = new NutDao(SwingNoteApplication.dataSource);

        List<NoteForder> people = dao.query(NoteForder.class, null);

        System.out.println(people.size());
        System.out.println(people.get(1).pid);
        System.out.println(people.get(1).subNoteForders.size());
    }

    @Name
    @Column("id")
    private String id = null;

    /**
     * 名称
     */
    @Column("name")
    private String name = null;

    @Column("pid")
    private String pid = null;

    /**
     * 最后修改时间
     */
    @Column("lastUpdateTime")
    private Date lastUpdateTime = null;

    private NoteForder parent = null;

    private List<NoteForder> subNoteForders = null;

    private List<Note> notes = null;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public Date getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(Date lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    public NoteForder getParent() {
        return parent;
    }

    public void setParent(NoteForder parent) {
        this.parent = parent;
    }

    public List<NoteForder> getSubNoteForders() {
        return subNoteForders;
    }

    public void setSubNoteForders(List<NoteForder> subNoteForders) {
        this.subNoteForders = subNoteForders;
    }

    public List<Note> getNotes() {
        return notes;
    }

    public void setNotes(List<Note> notes) {
        this.notes = notes;
    }

}
